We need to attach a console before rebooting to make sure the domain did
actually boot in the first place. Also, use a better method for pulling out
the uptime string.
print e.extra
FAIL(str(e))
+try:
+ console = XmConsole(domain.getName())
+except ConsoleError, e:
+ FAIL(str(e))
+
+console.closeConsole()
+
status, output = traceCommand("xm reboot %s" % domain.getName())
if status != 0:
domain.destroy()
-items = re.split(" +", run["output"])
-uptime = int(items[3])
-if uptime > 1:
- FAIL("Uptime too large (%i > 1 minutes); domain didn't reboot")
+match = re.match("^[^up]*up ([0-9]+).*$", run["output"])
+if match:
+ if int(match.group(1)) > 1:
+ FAIL("Uptime too large (%i > 1 minutes); domain didn't reboot")
+else:
+ FAIL("Invalid uptime string: %s (%s)" % (run["output"], match.group(1)))
+